home *** CD-ROM | disk | FTP | other *** search
- ; Good ol towers of hanoi
- ; converted from xlisp to Mutt 12/86 C Durland
- ; Usage:
- ; (hanoi <n>)
- ; <n> - number of discs
-
- (const NUMBER 0x03)
-
- (defun
- print-move (from to) { (msg "Move Disk From " from " To " to) }
- transfer (from to via)(int n)
- {
- (if (== n 1)(print-move from to)
- {
- (transfer from via to (- n 1))
- (print-move from to)
- (transfer via to from (- n 1))
- })
- }
- hanoi MAIN
- { (transfer "A" "B" "C" (convert-to NUMBER (ask "n = ")))(msg "done.") }
- )
-